﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;

namespace GermaneShanidze.Applications.Jokeri.LobbyDuplexService
{
    // User initiating to become a host of a session
    [DataContract]
    public class HostSessionMessage : DuplexMessage
    {
        [DataMember]
        public string Username;
    }

    // User initiating to join an existing session
    [DataContract]
    public class JoinSessionMessage : DuplexMessage
    {
        [DataMember]
        public string Username;
        [DataMember]
        public string SessionKey;
    }

    // Message containing the actual file bytes
    [DataContract]
    public class FileTransferBytesMessage : DuplexMessage
    {
        [DataMember]
        public long StartByte;
        [DataMember]
        public long PacketSize;
        [DataMember]
        public byte[] Bytes;
        [DataMember]
        public bool EndFile;
    }

    // A message informing the other user that a file transfer has begun and gives file details
    [DataContract]
    public class FileBeginUploadMessage : DuplexMessage
    {
        [DataMember]
        public string FileName;
        [DataMember]
        public long TotalBytes;
    }

    // Message to tell the sender that file has been denied
    [DataContract]
    public class FileDenyMessage : DuplexMessage
    {
        [DataMember] public string Reason;
    }

    // For the receiving person to let the user know that they have succesfully received the entire file
    [DataContract]
    public class FileReceivedMessage : DuplexMessage { }

    // Lets host know that user has disconnected
    [DataContract]
    public class ClientDisconnectedMessage : DuplexMessage { }

    // Let's user know that the host has disconnected/ended session
    [DataContract]
    public class HostDisconnectedMessage : DuplexMessage { }

    // Message back to the initiator, generated by the server.
    [DataContract]
    public class HostSessionServerMessage : DuplexMessage
    {
        [DataMember]
        public bool Failed;
        [DataMember]
        public string SessionKey;

    }

    // Message to the host, informing them of a client connection
    [DataContract]
    public class ClientConnectedMessage : DuplexMessage
    {
        [DataMember]
        public string Username;
    }

    // Message back to the user trying to join, generated by the server
    [DataContract]
    public class JoinSessionServerMessage : DuplexMessage
    {
        [DataMember]
        public bool Failed;
        [DataMember]
        public string SessionNumber;

        [DataMember]
        public string Hostname;
    }


    // Generic chat message
    [DataContract]
    public class ChatMessage : DuplexMessage
    {
        [DataMember]
        public bool IsPublic;

        [DataMember]
        public string Message;
    }

    [DataContract]
    public class GeneralError : DuplexMessage
    {
        [DataMember] 
        public string ErrorMessage;
    }


}